#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<vector>
using namespace std;

class Solution {
public:
    double findMaxAverage(vector<int>& nums, int k)
    {
        double ret = INT_MIN;
        double mid = 0;
        for (int i = 0; i < nums.size(); i++)
        {
            mid += nums[i];
            if (i < k - 1)
                continue;
            ret = max(ret, (mid / k));
            mid -= nums[i - k + 1];
        }
        return ret;
    }
};
